<template>
  <div id="app">
    <keep-alive include="HomeViewCom">
      <router-view></router-view>
    </keep-alive>
    <van-tabbar route v-if="curPath">
      <van-tabbar-item to="/home">
        <span>首页</span>
        <template #icon="props">
          <img src="@/assets/home/home_selected.png" v-if="props.active" />
          <img src="@/assets/home/home_no_selected.png" v-else />
        </template>
      </van-tabbar-item>
      <van-tabbar-item to="/classification">
        <span>菜谱分类</span>
        <template #icon="props">
          <img src="@/assets/home/home_menu_s.png" v-if="props.active" />
          <img src="@/assets/home/home_menu_n.png" v-else />
        </template>
      </van-tabbar-item>
      <van-tabbar-item to="/kitchen">
        <span>厨房故事</span>
        <template #icon="props">
          <img src="@/assets//home/icon_story_yellow.png" v-if="props.active" />
          <img src="@/assets/home/icon_story_gray.png" v-else />
        </template>
      </van-tabbar-item>
      <van-tabbar-item to="/more">
        <span>更多</span>
        <template #icon="props">
          <img src="@/assets/home/home_more_s.png" v-if="props.active" />
          <img src="@/assets/home/home_more_n.png" v-else />
        </template>
      </van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
export default {
  name: 'app',
  data() {
    return {}
  },
  computed: {
    curPath() {
      let pathList = ['/home', '/classification', '/kitchen', '/more']
      if (pathList.indexOf(this.$route.path) == -1) {
        return false
      }
      return true
    }
  }
}
</script>

<style lang="less" scoped>
#app {
  padding-bottom: 60px;
  .van-tabbar {
    height: 60px;
    z-index: 999999999;

    .van-tabbar-item--active {
      color: #ffd861;
    }

    .van-tabbar-item__icon img {
      height: 25px;
      width: auto;
    }
  }
}
</style>
